#include "TK.h"

int main(int argc, char *argv[]){
	char name[10];
	int array[argc-2+1];//"+1" is for heap_sort.
	int i,j;
	if(argc<2)
	{
		printf("usage: designate a sort pattern and type a succession of figures please.\nyou can run ./Sort --help to get more information.\n");
		return 0;	
	}

	i = (strcmp(argv[1],"-H")&&strcmp(argv[1],"--heap")) == 0 ? 1 : 0;
	int flag = i;//flag is for heap_sort.

	for(j=2;j<argc;i++,j++)
	array[i]=atoi(argv[j]);

	if(sort(argc-2,array,name,argv))
	{
		printf("the results of %s sort is ",name);
		for(i=flag;i<argc-2;i++)
		printf("%d ",array[i]);
		if(flag)
		printf("%d ",array[i]);
	}
	printf("\n");

	return 0;
}
